/*
 * Flashlib - QB9 common Flash library
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.qb9.flashlib.audio
{
	import flash.events.IEventDispatcher;
	import com.qb9.flashlib.interfaces.IDisposable;
	
	/**
	 * Interface to be implemented by all classes that can be
	 * registered to an AudioMixer.
	 */
	public interface IPlayable extends IEventDispatcher, IDisposable
	{
		/** Unique identifier */
		function get id() : String;
		/** @private */
		function set id(id:String) : void;

		/** Duration of the audio (milliseconds). */
		function get length() : Number;
		
		/** Volume setting, between 0.0 and 1.0. */
		function get volume() : Number;
		/** @private */
		function set volume(vol:Number) : void;

		/** Current playback position. */
		function get position() : Number;
		/** @private */
		function set position(pos:Number) : void;
		
		/** Paused status. */
		function get paused() : Boolean;
		/** Playing status. */
		function get playing() : Boolean;
		/** Muted status. */
		function get muted() : Boolean;
		
		/** Start/resume playback. */
		function play() : void;
		/** Resume playback. */
		function resume() : void;
		/** Pause playback. */
		function pause() : void;
		/** Stop playback. */
		function stop() : void;
		/** Start/resume playback and loop for a given amount of times. */
		function loop(times:int = int.MAX_VALUE) : void;
		
		/**
		 * Mute the audio.
		 * @see #unmute()
		 */
		function mute() : void;
		/**
		 * Unmute the audio. The volume setting is preserved.
		 * @see #mute()
		 */
		function unmute() : void;
	}
}
